Imports System
Imports ValidationFramework


Public Class CompareByteRuleAttributeExample

    'Methods
    Public Sub DoSomething( _
     <CompareByteRule(5, CompareOperator.LessThan)> ByVal paramData As Byte)
        ParameterValidationManager.ThrowException(Me, doSomethingHandle, paramData)
    End Sub


    ' Properties
    <CompareByteRule(5, CompareOperator.LessThan)> _
    <CompareByteRule(2, CompareOperator.GreaterThan, _
    ErrorMessage:="Data must be greater than 2.")> _
    Public Property Data() As Byte
        Get
            Return _data
        End Get
        Set(ByVal value As Byte)
            _data = value
        End Set
    End Property


    ' Fields
    Private _data As Byte
    Private Shared ReadOnly doSomethingHandle As RuntimeMethodHandle = _
    GetType(CompareByteRuleAttributeExample).GetMethod("DoSomething").MethodHandle

End Class

